<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:rich="http://richfaces.org/rich"
      xmlns:a4j="http://richfaces.org/a4j"
      xmlns:t="http://myfaces.apache.org/tomahawk">

<ui:composition template="/layouts/CrudPesquisar.xhtml">
	<ui:param name="bean" value="#{ManageUsuario}" />

	<ui:define name="breadcrumb_content">
		<h:outputLink value="/cpp-web/pages/cadastros.jsf" title="Cadastros">Cadastros</h:outputLink>
			<h:outputText> » </h:outputText>
		<h:outputLink value="#" title="Listagem de Usuários" styleClass="active">Listagem de Usuários</h:outputLink>
	</ui:define>
		
	<ui:define name="quick_links">
		<ui:include src="/layouts/cadastros_links.xhtml" />
	</ui:define>
			
	<ui:define name="OUTRAS_ACOES">
		<h:commandButton action="#{bean.importarDados}" value="Importar Dados" />
	</ui:define>


	<ui:define name="PESQUISA">
			<h:form id="formPesquisar">
				<fieldset id="dadosPesquisa">
					<div class="legenda"><span></span></div>
					<ul>
						<li> 
							<h:outputLabel value="Nome:" for="nome" />
							<h:inputText value="#{bean.nomeUsuario}" id="nome" />
						</li>
						<li>
							<h:commandButton action="#{bean.filtrar}" value="Buscar Usuários" styleClass="btForm" />
						</li>
					</ul>
				</fieldset>
			</h:form>
	</ui:define>

	<ui:define name="COLUNAS">
		<h:column>
			<f:facet name="header">
				<h:outputText value="Nome" />
			</f:facet>
			<h:outputText value="#{item.nome}" />
		</h:column>
		<h:column>
			<f:facet name="header">
				<h:outputText value="Login" />
			</f:facet>
			<h:outputText value="#{item.login}" />
		</h:column>
		<h:column>
			<f:facet name="header">
				<h:outputText value="E-mail" />
			</f:facet>
			<h:outputText value="#{item.email}" />
		</h:column>
		<h:column>
			<f:facet name="header">
				<h:outputText value="Perfil" />
			</f:facet>
			<h:outputText value="#{item.perfil}" />
		</h:column>
		<h:column>
			<f:facet name="header">
				<h:outputText value="Diretoria" />
			</f:facet>
			<h:outputText value="#{item.diretoria.sigla}" />
		</h:column>
	</ui:define>
	
	<ui:define name="COLUNA_ACOES_DIREITA">
	</ui:define>	
	
	<ui:define name="COLUNA_ACOES">
		<h:column headerClass="colunaAcoes">
		    <f:facet name="header">
                <h:outputText value="Editar"/>
            </f:facet>
             <h:panelGroup rendered="#{SessionUser.usuario.id != item.id and SessionUser.usuario.perfil.ordinal > item.perfil.ordinal}" >								
					<h:commandLink 
						action="#{bean.exibirAlteracao}" title="Editar" immediate="true" >
						<h:graphicImage value="/images/editar.png" />
						<f:setPropertyActionListener value="#{item}" target="#{bean.dadosForm}"/>					
					</h:commandLink>
			</h:panelGroup>            
		</h:column>        
		<h:column headerClass="colunaAcoes">
		    	<f:facet name="header">
	                <h:outputText value="Excluir"/>
	            </f:facet>	
               	<h:panelGroup rendered="#{SessionUser.usuario.id != item.id and SessionUser.usuario.perfil.ordinal > item.perfil.ordinal}" >					
					<h:commandLink 
						 action="#{bean.exibirExclusao}"  title="Excluir" immediate="true">
						<h:graphicImage value="/images/excluir.png" />
						<f:setPropertyActionListener value="#{item}" target="#{bean.dadosForm}"/>					
					</h:commandLink>
				</h:panelGroup>
		</h:column>
	</ui:define>
		

	</ui:composition>

</html>
